﻿@{
    var cookie = Request.Cookies[FormsAuthentication.FormsCookieName];
    if (cookie != null)
    {
        var auth = FormsAuthentication.Decrypt(cookie.Value);

        ViewBag.auth = auth;
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
</head>
<body>
    <div class="page">
        <div id="header">
            <div id="title" >
                <h1>Informational portal</h1>
                
            </div>
            
            <div id="logindisplay">

                @Html.Partial("_LogOnPartial")
            </div>
            <div id="menucontainer">
            
                <ul id="menu">
                @if (ViewBag.auth == null)
                {
                        <li>@Html.ActionLink("Registration", "Index", "reg")</li>
                }
                 @if (ViewBag.auth != null)
                 {
                     if(ViewBag.auth.UserData == "1" || ViewBag.auth.UserData == "2")
                     {
                         <li>@Html.ActionLink("Controll panel", "Index", "Admin")</li>
                     }
                 }
                    
                    <li><a href="/">News</a></li>
                 @if (ViewBag.auth != null)
                 {
                        <li><a href="/AccountControll/">Account</a></li>
                 }

                </ul>
            </div>
            <div id="search">

            @Html.Partial("_search")

            </div>
        </div>
         
            
            
        <div id="main">
        <table width="100%">
            <tr>
            <td>
         @{
             var url = Request.RequestContext.RouteData.Values["controller"];
         }
        @if (url.ToString().ToLower().IndexOf("admin") == -1)
        {
      
            <div id="categories" style="float: left;padding-left: 0px;padding-right: 135px;">
        @Html.Partial("_left")
        </div>
        }
        
        <div id="content" style="padding-top:35px;">
       
         
        @RenderBody()

      
        </div>
         </td>
            </tr>
            </table> 
        </div>
        

        <div id="footer">
        @if (ViewBag.pager != null)
        {
            @Html.Partial("_pager")
        }
        </div>
    </div>
</body>
</html>
